package com.tjp.eight.ui.fragment.mymsg;

import android.os.Bundle;
import android.support.annotation.Nullable;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

import com.tjp.eight.R;
import com.tjp.eight.ui.fragment.BaseFragment;
import com.tjp.eight.utils.ActivityUtils;
import com.tjp.eight.utils.SharePreferencesUtils;
import com.tjp.eight.views.CircleImageView;

/**
 * Created by Administrator on 2017/2/27.
 */
public class FragmentMyMsg extends BaseFragment<MyMsgPresenter> {
    CircleImageView civ_praise_tips;
    CircleImageView civ_comment_tips;
    @Override
    protected MyMsgPresenter createPresenter() {
        return null;
    }

    @Nullable
    @Override
    public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
        contentView = super.onCreateView(inflater, container, savedInstanceState);
        if (contentView == null) {
            contentView = inflater.inflate(R.layout.fragment_my_msg, container, false);
        }
        initViews();
        return contentView;
    }

    private void initViews() {
        civ_comment_tips = (CircleImageView) contentView.findViewById(R.id.civ_comment_tips);
        civ_praise_tips = (CircleImageView) contentView.findViewById(R.id.civ_praise_tips);
        if (SharePreferencesUtils.getCommentTips() == 0){
            civ_comment_tips.setVisibility(View.GONE);
        }else {
            civ_comment_tips.setVisibility(View.VISIBLE);
        }
        if (SharePreferencesUtils.getPraiseTips() == 0){
            civ_praise_tips.setVisibility(View.GONE);
        }else {
            civ_praise_tips.setVisibility(View.VISIBLE);
        }
        contentView.findViewById(R.id.rl_msg_zan).setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                ActivityUtils.startWhoZan(getActivity());
            }
        });
        contentView.findViewById(R.id.rl_who_comment).setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                ActivityUtils.startWhoComment(getActivity());
            }
        });
    }
}
